/**
 * @class GroupHoverbox
 * @extends AbstractHoverbox
 * @constructor
 * @param {PersonGroup} node 
 * @param {Number} centerX 
 * @param {Number} centerY 
 * @param {Raphael.st} nodeShapes 
 */

var PersonGroupHoverbox = Class.create(PersonHoverbox, {
    initialize: function($super, personNode, centerX, centerY, nodeShapes) {
        var radius = PedigreeEditor.attributes.radius * 2;
        $super(personNode, centerX, centerY, nodeShapes);
       },

    /**
    *
    * @method generateHandles
    * @return {Raphael.st} 
    */
    generateHandles: function($super) {
        var hiddenFlag = parent.$("#hiddenFlag").val();
		if(hiddenFlag == "true"){
            return;
        }
        if (this._currentHandles !== null) return;

        if (PedigreeEditor.attributes.newHandles) {
        }
    },

    /**
     *
     * @method generateButtons
     */
    generateButtons: function($super) {
        var hiddenFlag = parent.$("#hiddenFlag").val();
		if(hiddenFlag == "true"){
            return;
        }
        if (this._currentButtons !== null) return;
        $super();

        this.generateMenuBtn();
        this.generateDeleteBtn();
    },

    /**
     *
     * @method isMenuToggled
     * @return {Boolean}
     */
    isMenuToggled: function() {
        return this._isMenuToggled;
    },

    /**
     *
     * @method toggleMenu
     */
    toggleMenu: function(isMenuToggled) {
        var hiddenFlag = parent.$("#hiddenFlag").val();
		if(hiddenFlag == "true"){
            return;
        }
        if (this._justClosedMenu) return;
        this._isMenuToggled = isMenuToggled;
        if(isMenuToggled) {
            this.getNode().getGraphics().unmark();
            var optBBox = this.getBoxOnHover().getBBox();
            var x = optBBox.x2;
            var y = optBBox.y;
            var position = editor.getWorkspace().canvasToDiv(x+5, y);
            editor.getNodeGroupMenu().show(this.getNode(), position.x, position.y);
        }
    },

    /**
     *
     * @method animateHideHoverZone
     */
    animateHideHoverZone: function($super) {
        var hiddenFlag = parent.$("#hiddenFlag").val();
		if(hiddenFlag == "true"){
            return;
        }
        this._hidden = true;
        if(!this.isMenuToggled()){
            var parentPartnershipNode = editor.getGraph().getParentRelationship(this.getNode().getID());
            if (parentPartnershipNode && editor.getNode(parentPartnershipNode))
                editor.getNode(parentPartnershipNode).getGraphics().unmarkPregnancy();
            $super();
        }
    },

    /**
     *
     * @method animateDrawHoverZone
     */
    animateDrawHoverZone: function($super) {
        this._hidden = false;
        if(!this.isMenuToggled()){
            var parentPartnershipNode = editor.getGraph().getParentRelationship(this.getNode().getID());
            if (parentPartnershipNode && editor.getNode(parentPartnershipNode))
                editor.getNode(parentPartnershipNode).getGraphics().markPregnancy();
            $super();
        }
    }
});
